package com.walter.controller;

import com.walter.common.BaseController;
import com.walter.common.PageVO;
import com.walter.common.Result;
import com.walter.entity.Param;
import com.walter.model.form.UpdateParamForm;
import com.walter.model.query.ParamQuery;
import com.walter.service.ParamService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：ch
 * @date ：Created in 2021/5/25
 * @description：
 * @modified By：
 * @version: 1.0
 */
@RestController
@RequestMapping("api/param")
public class ParamController extends BaseController {
    @Autowired
    private ParamService paramService;

    @PostMapping(value = "find")
    @ApiOperation("后管 分页查询系统参数")
    public Result<PageVO<Param>> find(@RequestBody ParamQuery query){
        return success(paramService.find(query));
    }

    @GetMapping(value = "findOne")
    @ApiOperation("后管 查询单个系统参数详情")
    public Result<Param> findOne(@RequestParam String key){
        return success(paramService.findOne(key));
    }

    @PostMapping(value = "updateParam")
    @ApiOperation("后管 修改系统参数")
    public Result<Integer> updateParam(@RequestBody UpdateParamForm form){
        return success(paramService.updateParam(form));
    }
}
